package common;

import java.io.Reader;

import java.sql.Timestamp;
import java.util.List;
import java.util.ArrayList;

import shop.GoodsBean;

import board.free.FBBoardVO;
import board.news.NewsBoardVO;
import board.notice.NoticeBoardVO;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
import com.opensymphony.xwork2.ActionSupport;

public class mainAction extends ActionSupport {
	
	public static Reader reader;
	public static SqlMapClient sqlMapper;
	
	private List<NoticeBoardVO> list = new ArrayList<NoticeBoardVO>();
	private List<NewsBoardVO> list1 = new ArrayList<NewsBoardVO>();
	private List<FBBoardVO> list2 = new ArrayList<FBBoardVO>();
	private List<GoodsBean> list3 = new ArrayList<GoodsBean>();
	
	public mainAction() throws Exception{
		reader = Resources.getResourceAsReader("sqlMapConfig.xml");
		sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader);
		reader.close();
	}
	
	public String execute() throws Exception{
		
		list = sqlMapper.queryForList("noticeSelectAll");
		list1 = sqlMapper.queryForList("newsSelectAll");
		list2 = sqlMapper.queryForList("freeSelectAll");
		list3 = sqlMapper.queryForList("selectAll-a");
		return SUCCESS;
	}

	public List<NoticeBoardVO> getList() {
		return list;
	}

	public void setList(List<NoticeBoardVO> list) {
		this.list = list;
	}

	public List<NewsBoardVO> getList1() {
		return list1;
	}

	public void setList1(List<NewsBoardVO> list1) {
		this.list1 = list1;
	}

	public List<FBBoardVO> getList2() {
		return list2;
	}

	public void setList2(List<FBBoardVO> list2) {
		this.list2 = list2;
	}

	public List<GoodsBean> getList3() {
		return list3;
	}

	public void setList3(List<GoodsBean> list3) {
		this.list3 = list3;
	}
}